export default {
    install: (Vue, option) => {
        Vue.prototype.uxtToast = p => {
            let pages = getCurrentPages()

            // #ifdef H5
            let layout = pages[pages.length - 1].$children[0]
            // #endif

            // #ifndef H5
            let layout = pages[pages.length - 1].$vm.$children[0]
            // #endif

            // console.log(layout)
            layout.setToast(p)
            
            return {
                loading() {
                    layout.showToast('loading')
                },
                success() {
                    layout.showToast('success')
                },
                fail() {
                    layout.showToast('fail')
                },
                show() {
                    layout.showToast()
                },
                hide() {
                    layout.hideToast()
                }
            }
        }
    }
}
